﻿@model IEnumerable<ABCTile.Models.Company>
@{
	ViewBag.Title = "Search";
}
<h2>
	Search</h2>
<p>
	@Html.ActionLink("Create New Company", "Create") | @Html.ActionLink("Return to Company List", "Index")
</p>
@using (Html.BeginForm())
{
	<table>
		<tr>
			<th>
				Company Name:
			</th>
			<td colspan="2">@Html.TextBox("companyName")
			</td>
		</tr>
		<tr>
			<th>
				Street Address:
			</th>
			<td>@Html.TextBox("streetAddr")
			</td>
			<td>
				<input type="submit" value="Search" />
			</td>
		</tr>
		<tr>
			<th>
				Office Phone:
			</th>
			<td colspan="2">@Html.TextBox("officePhone")
			</td>
		</tr>
	</table>    
}
<br />
<table>
	<tr>
		<th>
			Company Name:
		</th>
		<th>
			Branch:
		</th>
		<th>
			Contact Role:
		</th>
		<th>
			Contact Person ID:
		</th>
		<th>
			Office Phone:
		</th>
		<th>
			Office Fax:
		</th>
		<th>
			Cell Phone:
		</th>
		<th>
			Company URL:
		</th>
		<th>
			Address:
		</th>
		<th>
			Comments:
		</th>
		<th>
		</th>
	</tr>
@if (Model.Count() == 0)
 {
	<tr>
		<td colspan="0" style=" text-align: center; color: Red;">There were no companies found that match that criteria.
		<br />Please revise your search queries.</td>
	</tr>
 }
 else
 {
	 foreach (var item in Model)
	 {
		<tr>
			<td>
				@Html.DisplayFor(modelItem => item.Company_Name)
			</td>
			<td>
				@Html.DisplayFor(modelItem => item.Branch_Seq)
			</td>
			<td>
				@Html.DisplayFor(modelItem => item.Contact_Role)
			</td>
			<td>
				@Html.DisplayFor(modelItem => item.Contact_Person_ID)
			</td>
			<td>
				@Html.DisplayFor(modelItem => item.Office_Phone)
			</td>
			<td>
				@Html.DisplayFor(modelItem => item.Office_Fax)
			</td>
			<td>
				@Html.DisplayFor(modelItem => item.Cell_Phone)
			</td>
			<td>
				@{
					string url = "http://" + Html.DisplayFor(model => item.Company_url);
				}
				<a href=@url target=_blank>@Html.DisplayFor(model => item.Company_url)</a>
			</td>
			<td>
				@Html.DisplayFor(modelItem => item.Street_Address)<br />
				@Html.DisplayFor(modelItem => item.City), @Html.DisplayFor(modelItem => item.State) @Html.DisplayFor(modelItem => item.Zip)
			</td>
			<td>
				@Html.DisplayFor(modelItem => item.Comments)
			</td>
			<td>
				@Html.ActionLink("Edit", "Edit", new { id = item.ID }) |
				@Html.ActionLink("Details", "Details", new { id = item.ID }) |
				@Html.ActionLink("Delete", "Delete", new { id = item.ID })
			</td>
		</tr>
	 }
 }
</table>
